﻿#ifndef PERF_H
#define PERF_H

#include <cstdint>
#include <iostream>

struct Perf
{
	uint64_t total_count;  // Total Address Accesses
	uint64_t total_clocks; // Total Clock Cycles
	uint64_t hits;		   // Address hits to TLB
	uint64_t misses;	   // Address misses to TLB
	uint64_t faults;// Address Faults
	uint64_t mem_count;	   // Total Page Memory Accesses
	uint64_t mem_clocks;   // Total Page Memory Clock Cycles
	Perf() : total_count(0), total_clocks(0), hits(0), misses(0), faults(0), mem_count(0), mem_clocks(0) {}
	friend std::ostream& operator<<(std::ostream& os, Perf& p)
	{
		os << "Total Address Accesses: " << p.total_count << std::endl;
		os << "Total Clock Cycles: " << p.total_clocks << std::endl;
		os << "Address hits to TLB: " << p.hits << std::endl;
		os << "Address misses to TLB: " << p.misses << std::endl;
		os << "Address Access Errors: " << p.faults << std::endl;
		os << "Total Page Memory Accesses: " << p.mem_count << std::endl;
		os << "Total Page Memory Clock Cycles: " << p.mem_clocks << std::endl;
		return os;
	}
};

#endif